Soru & Cevap

FATAL EXCEPTION hatası

06.09.2017 - 01:45

09-06 13:01:49.950 25871-25871/com.turk.hava1 E/AndroidRuntime: FATAL EXCEPTION: main

                                                                Process: com.turk.hava1, PID: 25871

                                                                java.lang.RuntimeException: Unable to start activity ComponentInfo{com.turk.hava1/com.turk.hava1.MainActivity}: java.lang.SecurityException: "network" location provider requires ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission.

                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2434)

                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494)

                                                                    at android.app.ActivityThread.access$900(ActivityThread.java:153)

                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347)

                                                                    at android.os.Handler.dispatchMessage(Handler.java:102)

                                                                    at android.os.Looper.loop(Looper.java:148)

                                                                    at android.app.ActivityThread.main(ActivityThread.java:5451)

                                                                    at java.lang.reflect.Method.invoke(Native Method)

                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)

                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

                                                                 Caused by: java.lang.SecurityException: "network" location provider requires ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission.

                                                                    at android.os.Parcel.readException(Parcel.java:1620)

                                                                    at android.os.Parcel.readException(Parcel.java:1573)

                                                                    at android.location.ILocationManager$Stub$Proxy.getLastLocation(ILocationManager.java:717)

                                                                    at android.location.LocationManager.getLastKnownLocation(LocationManager.java:1249)

                                                                    at com.turk.hava1.MainActivity.onCreate(MainActivity.java:78)

                                                                    at android.app.Activity.performCreate(Activity.java:6323)

                                                                    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1108)

                                                                    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2387)

                                                                    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2494) 

                                                                    at android.app.ActivityThread.access$900(ActivityThread.java:153) 

                                                                    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1347) 

                                                                    at android.os.Handler.dispatchMessage(Handler.java:102) 

                                                                    at android.os.Looper.loop(Looper.java:148) 

                                                                    at android.app.ActivityThread.main(ActivityThread.java:5451) 

                                                                    at java.lang.reflect.Method.invoke(Native Method) 

                                                                    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 

                                                                    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 

MainActivity.java:78 bu satırda sağdaki kod var --->  
Location location = locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER); 

neden boyle oldu bir fikri olan var mı?
 

37 Görüntülenme

1 Cevap

Sitedeki sorulara cevap verebilmek için giriş yapın ya da üye olun.

picture-10362-1393062745.jpg
BYTUNCAY
06.09.2017 - 02:52

AndroidManifest dosyanıza bu satırları ekleyin 

 

<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>